<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Collection interface</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ds.examples.html">« 范例</a></li>
      <li style="float: right;"><a href="ds-collection.clear.html">Ds\Collection::clear »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.ds.html">Data Structures</a></li>
    <li>The Collection interface</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.ds-collection" class="reference">

 <h1 class="title">The Collection interface</h1>
 

 <div class="partintro"><p class="verinfo">(No version information available, might only be in Git)</p>


  <div class="section" id="ds-collection.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <span class="classname"><strong class="classname">Collection</strong></span> is the base interface which covers functionality
    common to all the data structures in this library. It guarantees that all structures
    are traversable, countable, and can be converted to json using <span class="function"><a href="function.json-encode.html" class="function">json_encode()</a></span>.
   </p>
  </div>


  <div class="section" id="ds-collection.synopsis">
   <h2 class="title">接口摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">

    <span class="ooclass"><span class="modifier">class</span> <strong class="classname">Ds\Collection</strong></span>

    <span class="oointerface"><span class="modifier">implements</span>  <a href="class.countable.html" class="interfacename">Countable</a></span><span class="oointerface">,  <a href="class.iteratoraggregate.html" class="interfacename">IteratorAggregate</a></span><span class="oointerface">,  <a href="class.jsonserializable.html" class="interfacename">JsonSerializable</a></span> {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="ds-collection.clear.html" class="methodname">clear</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="ds-collection.copy.html" class="methodname">copy</a></span>(): <span class="type"><a href="class.ds-collection.html" class="type Ds\Collection">Ds\Collection</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="ds-collection.isempty.html" class="methodname">isEmpty</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="ds-collection.toarray.html" class="methodname">toArray</a></span>(): <span class="type">array</span></div>

   }</div>


  </div>

  <div class="section">
   <h2 class="title">更新日志</h2>
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL ds 1.4.0</td>
       <td>
        <span class="classname"><strong class="classname">Collection</strong></span> implements
        <span class="interfacename"><a href="class.iteratoraggregate.html" class="interfacename">IteratorAggregate</a></span> now instead of just <span class="interfacename"><a href="class.traversable.html" class="interfacename">Traversable</a></span>. (This change came to the polyfill in 1.4.1.)
       </td>
      </tr>

     </tbody>
    
   </table>

  </div>

 </div>

 





























<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="ds-collection.clear.html">Ds\Collection::clear</a> — Removes all values</li><li><a href="ds-collection.copy.html">Ds\Collection::copy</a> — Returns a shallow copy of the collection</li><li><a href="ds-collection.isempty.html">Ds\Collection::isEmpty</a> — Returns whether the collection is empty</li><li><a href="ds-collection.toarray.html">Ds\Collection::toArray</a> — Converts the collection to an array</li></ul>
</div>
</div></div></body></html>